<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>回调函数处理异步处理结果</title>
</head>
<body>
    
    <script>
        

        // 获取异步操作的结果 必须通过回调函数
        function fn (callback) {
            setTimeout(() => {
                let data = 'hello';
                callback(data);
            }, 1000);
        }

        console.log(fn(function (d) {
            console.log(d);
        }));
    
    </script>

</body>
</html>